package com.agent.user.controller.app;

import com.agent.common.result.ApiResponse;
import com.agent.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/register")
@RequiredArgsConstructor
public class AuthController {
    private final UserService userService;

    /**
     * 邮箱注册
     * @param email 邮箱
     * @param password 密码
     * @return 用户ID
     */
    @PostMapping("/email")
    public ApiResponse<Long> register(
            @RequestParam String email,
            @RequestParam String password) {
        Long userId = userService.register(email, password);
        return ApiResponse.success(userId);
    }
}